home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Garbo
/
Garbo.cdr
/
mac
/
hypercrd
/
hc2_x
/
regnpckg.sit
/
Region XCMD
/
stack.txt
< prev
Wrap
Text File
|
1990-12-10
|
7KB
|
247 lines
-- stack: in
-- format: 10 (HyperCard 2)
-- flags: 0x9000 (can't modify)
-- protect password hash: 0
-- maximum user level: 5 (scripting)
-- window: Rect(x1=32, y1=66, x2=448, y2=306)
-- screen: Rect(x1=0, y1=0, x2=512, y2=342)
-- card dimensions: w=416 h=240
-- scroll: x=0 y=0
-- background count: 1
-- first background id: 2620
-- card count: 1
-- first card id: 3066
-- list block id: 3828
-- print block id: 0
-- font table block id: 3515
-- style table block id: 3080
-- free block count: 1
-- free size: 5792 bytes
-- total size: 16384 bytes
-- stack block size: 6656 bytes
-- created by hypercard version: 0x02008000
-- compacted by hypercard version: 0x02008000
-- modified by hypercard version: 0x02008000
-- opened by hypercard version: 0x02008000
-- patterns[0]: 0x0000000000000000
-- patterns[1]: 0x8000000008000000
-- patterns[2]: 0x8800220088002200
-- patterns[3]: 0x8888222288882222
-- patterns[4]: 0x88AA22AA88AA22AA
-- patterns[5]: 0xCCAA33AACCAA33AA
-- patterns[6]: 0xEEAABBAAEEAABBAA
-- patterns[7]: 0xEEBBBBEEEEBBBBEE
-- patterns[8]: 0xFFBBFFEEFFBBFFEE
-- patterns[9]: 0xFFBBFFFFFFBBFFFF
-- patterns[10]: 0x8010022001084004
-- patterns[11]: 0xFFFFFFFFFFFFFFFF
-- patterns[12]: 0x8822882288228822
-- patterns[13]: 0x1122448811224488
-- patterns[14]: 0xC4800C6843023026
-- patterns[15]: 0xB130031BD8C00C8D
-- patterns[16]: 0xAA00AA00AA00AA00
-- patterns[17]: 0x8822552288225522
-- patterns[18]: 0x8855225588552255
-- patterns[19]: 0x77DD77DD77DD77DD
-- patterns[20]: 0x8000000000000000
-- patterns[21]: 0xAA55AA55AA55AA55
-- patterns[22]: 0x038448300C020101
-- patterns[23]: 0x8244394482010101
-- patterns[24]: 0x8814224188412214
-- patterns[25]: 0x8080413E080814E3
-- patterns[26]: 0x22048C7422179810
-- patterns[27]: 0xBE808808EB088880
-- patterns[28]: 0x25C8328964244C92
-- patterns[29]: 0xA29C41BE2AC914EB
-- patterns[30]: 0x40A00000040A0000
-- patterns[31]: 0x8040200002040800
-- patterns[32]: 0xAA00800088008000
-- patterns[33]: 0xFF80808080808080
-- patterns[34]: 0x081C22C180010204
-- patterns[35]: 0xFF808080FF080808
-- patterns[36]: 0xF87422478F172271
-- patterns[37]: 0xBF00BFBFB0B0B0B0
-- patterns[38]: 0xFF7FBE5DA2418000
-- patterns[39]: 0xFAF5FAF5A050A050
-- checksum: 0x5F8E4EF6
----- HyperTalk script -----
-- Region XCMD support scripts
-- © 1990, Nigel Perry. Free for personal use.
-- May not be used for commercial, profit-making or in ShareWare
-- without permission.
-- add menu item for creation
-- make sure BMTR trap exists
on setupRegions
install_BMTR
if "Objects" is in the menus then
if "New Region…" is not in menu "Objects" then
put "New Region…" before menuItem "New Button" of menu "Objects" with menuMessage "Region new"
end if
end if
if "Edit" is in the menus then
if "Regions…" is not in menu "Edit" then
put "Regions…" after menuItem "Icon..." of menu "Edit" with menuMessage "Region edit"
end if
end if
end setupRegions
-- remove menu item
on cleanupRegions
if "Objects" is in the menus then
if "New Region…" is in menu "Objects" then
delete menuItem "New Region…" of menu "Objects"
end if
end if
if "Edit" is in the menus then
if "Regions…" is in menu "Edit" then
delete menuItem "Regions…" of menu "Edit"
end if
end if
end cleanupRegions
-- support clip to PICT conversion
on doMenu cmd
if cmd is "Paste Picture" and the optionKey is down
then
get the long name of this stack
put word 2 of it into path
delete char 1 of path
delete last char of path
Region pastePICT,path
else
pass doMenu
end if
end doMenu
-- support edit mode selection
on choose ignore,tool
if tool Γëñ 3 and the optionKey is down
then
Region edit,tool
else
Region normal
end if
pass choose
end choose
-- toggle palette just like the Tools one
on keyDown key
if key is tab and the optionKey is down then
if "Region Palette" is in the windows then
set the visible of window "Region Palette" to not the visible of window "Region Palette"
end if
end if
pass keyDown
end keyDown
-- create a script to create a Region
-- designed to be called by Region XCMD only
function _dump_Region where
global targetRegion
global _region_handler
set cursor to busy
put return & "on" && _region_handler & return into handler
put the picture of window targetRegion into pict
put the region of window targetRegion into region
put the rect of window targetRegion into rect
put "Region" && targetRegion & "," & quote & rect & quote & "," & quote & pict & quote & "," & quote & region & quote & return after handler
set cursor to busy
put the mouseDown of window targetRegion into hand
if hand is not empty then
put "set the mouseDown of window" && targetRegion && "to" && _literal(hand) & return after handler
end if
set cursor to busy
put the mouseWithin of window targetRegion into hand
if hand is not empty then
put "set the mouseWithin of window" && targetRegion && "to" && _literal(hand) & return after handler
end if
set cursor to busy
put the mouseStillDown of window targetRegion into hand
if hand is not empty then
put "set the mouseStillDown of window" && targetRegion && "to" && _literal(hand) & return after handler
end if
set cursor to busy
put the mouseUp of window targetRegion into hand
if hand is not empty then
put "set the mouseUp of window" && targetRegion && "to" && _literal(hand) & return after handler
end if
set cursor to busy
put the idle of window targetRegion into hand
if hand is not empty then
put "set the idle of window" && targetRegion && "to" && _literal(hand) & return after handler
end if
set cursor to busy
put the idleTime of window targetRegion into val
if val Γëá 0 then
put "set the idleTime of window" && targetRegion && "to" && val & return after handler
end if
set cursor to busy
if the autoHilite of window targetRegion then
put "set the autoHilite of window" && targetRegion && "to true" & return after handler
end if
put "end" && _region_handler & return after handler
put empty into _region_handler
if where = 0 then -- card
put the script of this cd into x
set cursor to busy
set the script of this cd to (x & handler)
else if where = 1 then -- bg
put the script of this bg into x
set cursor to busy
set the script of this bg to (x & handler)
else if where = 2 then -- stk
put the script of this stack into x
set cursor to busy
set the script of this stack to (x & handler)
else -- clip
return handler
end if
return empty
end _dump_Region
-- convert text into a literal string
function _literal text
put quote into ans
repeat with i = 1 to the number of chars in text
put char i of text into c
if c = quote then
put quote && "& quote &" && quote after ans
else if c = return then
put quote && "& return & ¬" & return & quote after ans
else
put c after ans
end if
set cursor to busy
end repeat
put quote after ans
return ans
end _literal
function _edit_Region_Script
global targetRegion
global _region_handler
return EditScript("the" && _region_handler && "of window" && targetRegion, _region_handler && "of region" && targetRegion, "set the" && _region_handler && "of window" && targetRegion && "to editResult")
end _edit_Region_Script
on testEdit
global targetRegion
global _region_handler
ask "Region?"
put it into targetRegion
ask "Handler?"
put it into _region_handler
if not _edit_Region_Script() then
answer "Failed"
end if
end testEdit